<template>
  <tr>
    <td>
        <input type="checkbox" :checked="obj.checked" @input="$emit('change-all-event', index)">
    </td>
    <td>{{obj.name}}</td>
    <td>{{obj.price}}</td>
    <td>
        <button @click="$emit('controlnum-event', obj.num - 1)"
        :disabled="obj.num === 1">-</button>
        {{+obj.num}}
        <button @click="$emit('controlnum-event', obj.num + 1)">+</button>
    </td>
    <td>{{+obj.num * obj.price}}</td>
    <td>
        <button @click="del">删除</button>
    </td>
  </tr>
</template>
 
<script>
export default {
  name: "HomeWork",
  components: {},
  props: {
    obj: {
        type: Object,
        required: true,
    },
    index:{
        type: Number
    }
  },
  data() {
    return {};
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    del(){
       this.$emit('deltr-event', this.index)
    }
  }
};
</script>

<style scoped>
     
</style>